import java.util.HashSet;
import java.util.Set;

/**
 * 
 */

/**
 * @author TrinhNX
 * @start_date	: 2015/04/21
 * @end_date 	:
 */
public class Euler029 {

	public static void main(String[] args) {
		// optimize 1: Set the initialize , time reduce from 20ms to 10ms
		Set set = new HashSet<>(1000); 
		final int MAX = 100;
		final long start = System.currentTimeMillis();
		for (int a = 2; a <= MAX; a++) {
			for (int b = 2; b <= MAX; b++) {
				double value = Math.pow(a, b);
				if (!set.contains(value)) {
					set.add(value);
				}
			}
		}

		System.out.println("Size: " + set.size());
		System.out.println("End after: " + (System.currentTimeMillis() - start));
	}
}
